import javax.microedition.media.Manager;
import javax.microedition.media.Player;
import javax.microedition.media.PlayerListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Canvas;

public class VisualizationCanvas extends Canvas{
	private DrumMIDlet dr;
	private Display d;
	private Player pbd, psd;
	public VisualizationCanvas(DrumMIDlet dr, Display d){
		this.dr = dr;
		this.d = d;
		try{
			pbd = Manager.createPlayer("file:///E/BASS.WAV");				
			pbd.realize();								
			pbd.prefetch();
			psd = Manager.createPlayer("file:///E/SNARE.WAV");	
			psd.realize();								
			psd.prefetch();
		}
		catch(Exception e){}		
	}
	protected void keyPressed(int keycode){
            		if(keycode == KEY_NUM4)
                			try{
                    			pbd.start();
                			}
		                	catch(Exception e){}
            		if(keycode == KEY_NUM6)
                  	 	try{
                				psd.start();
                			}
                   		catch(Exception e){}
		if(keycode == KEY_POUND)
                  	 	try{
				dr.exit();
                			}
                   		catch(Exception e){}
        	}
	public void paint(Graphics g){
	}
}